package com.cloud.consumer.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
@Service
public class SayHelloService {
	@Autowired
	private RestTemplate restTemplate;
	
	@HystrixCommand(fallbackMethod="sayHelloFallback")
	public String sayHello(){
		return restTemplate.getForEntity("http://provider/helloController/sayHelloWorld",
				String.class).getBody();
	}
	public String sayHelloFallback(){
		return "sayHello error";
	}
	
}
